require "sdl"
require "opengl"

local myWindow = sdl:new("呵呵")
local r = 0.5
local array = {
    {0, r},
    {r * math.cos(234 * math.pi / 180), r * math.sin(234 * math.pi / 180)},
    {r * math.cos(18 * math.pi / 180), r * math.sin(18 * math.pi / 180)},
    {r * math.cos(162 * math.pi / 180), r * math.sin(162 * math.pi / 180)},
    {r * math.cos(306 * math.pi / 180), r * math.sin(306 * math.pi / 180)}
}

function myWindow:onRender()
    opengl.glClearColor(0.2, 0.2, 0.2, 0)
    opengl.glClear(bit.bor(0x4000, 0x100))
    opengl.glBegin(2);
    for i = 1, #array do
        local tab = array[i]
        opengl.glVertex2f(unpack(tab))
    end
    opengl.glEnd();
end
myWindow:render()
myWindow:loopMsg()
